﻿
using System.Net.Http;
using FluentHtmlHelpers.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace FluentHtmlHelpers.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult StronglyTyped()
        {
            return View(new SampleAlertModel() { AlertBoxText = "Message", AlertBoxStyle = MyHelpers.AlertStyle.Warning });
        }


        public ActionResult PersonView()
        {
            var person = new Person(){Name="Dariusz",Surname="Uchman"};

            return View(person);
        }

        public ActionResult UpdatePerson(Person person)
        {
            return RedirectToAction("PersonView");
        }


        public ActionResult Courses()
        {
            return View();
        }

        public ActionResult Twits()
        {
            Tweets model = null;
            HttpClient httpClient= new HttpClient();
            var task = httpClient.GetAsync("http://search.twitter.com/search.json?q=pluralsight").ContinueWith(httpReponse =>
                {
                    var response = httpReponse.Result;
                    var readTask = response.Content.ReadAsAsync<Tweets>();
                    readTask.Wait();
                    model = readTask.Result;
                });


            return View();
        }
        //public ActionResult NewTextBox()
        //{
        //    return View(new SampleAlertModel() { AlertBoxText = "Message", AlertBoxStyle = MyHelpers.AlertStyle.Warning });
        //}

    }

    public class Tweets
    {
    }
}
